<!--
 * @Description: 
 * @Author: wind-lc
 * @version: 1.0
 * @Date: 2022-09-02 18:15:51
 * @LastEditTime: 2022-09-06 16:38:31
 * @FilePath: \cscec-pms-admin\src\views\safetySupervision\hazardIdentification\hazardIdentificationList\seeSign.vue
-->
<template>
  <!-- 通用查看签到弹框 -->
  <a-modal
    :footer="null"
    title="签到人员"
    :closable="true"
    @cancel="handleClose"
    @ok="handleClose"
    :visible="visible"
    width="1200px"
  >
    <b-table
      bordered
      ref="table"
      :columns="column"
      :request="loadData"
      :show-page="false"
    >
      <span
        slot="serial"
        slot-scope="text, record, index"
      >{{ index + 1 }}</span>
    </b-table>
  </a-modal>
</template>

<script>
import Api from '@/api/office/hazardIdentification'

export default {
  props: {
    id: {
      type: String,
      default: ''
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      column: [
        {
          title: '序号',
          dataIndex: 'serial',
          width: '70px',
          scopedSlots: { customRender: 'serial' }
        },
        {
          title: '所属单位',
          dataIndex: 'signCompany',
          width: '18%',
          ellipsis: true
        },
        {
          title: '岗位',
          dataIndex: 'postName',
          width: '13%',
          ellipsis: true
        },
        {
          title: '姓名',
          dataIndex: 'signUser',
          ellipsis: true
        },
        {
          title: '签到类型',
          dataIndex: 'signUserType'
        },
        {
          title: '是否签到',
          dataIndex: 'signIn',
          customRender: (text, record, index) => {
            return text ? '已签到' : '未签到'
          }
        },
        {
          title: '签到地点',
          dataIndex: 'signAddress',
          width: '27%',
          ellipsis: true
        },
        {
          title: '签到时间',
          dataIndex: 'signDate',
          ellipsis: true
        }
      ],
      loadData: async (q) => {
        return Api.meetSignList({}, Object.assign(q, { dangerMeetId: this.id }))
      }
    }
  },
  methods: {
    handleClose() {
      this.$emit('update:visible', false)
    }
  },
  watch: {
    visible(v) {
      if (v) {
        this.$nextTick(() => {
          this.$refs.table.refresh()
        })
      }
    }
  }
}
</script>

